﻿
namespace Ndex.Core
{
    public enum Gender
    {
        NA = 0,
        Male = 1,
        Female = 2,
    }

    public static class GenderExt
    {
        public static bool? ToBool(this Gender type)
        {
            if (type == Gender.Male)
                return true;
            if (type == Gender.Female)
                return false;
            return null;
        }

        public static Gender ToGender(this bool? value)
        {
            if (value == true)
                return Gender.Male;
            if (value == false)
                return Gender.Female;
            return Gender.NA;
        }
    }
}
